<%@ page pageEncoding="utf-8"%>
<%-- 引入JSTL标签库 --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html>
<head>
	<title>订单详情</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="/resources/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="/resources/js/commons.js"></script>
	<script type="text/javascript" src="/resources/layer-v3.1.1/layer/layer.js"></script>
	<link rel="stylesheet" type="text/css" href="/resources/css/commons.css" />
</head>
<body>
	<h2>订单详情</h2>
	<hr/>
	<form>
		<!-- hidden隐藏域,在提交表单时连order.id一起提交 -->
		<table border="1">
			<tr>
				<td width="30%">编号</td>
				<td>
					${ order.id }
				</td>
			</tr>
			<tr>
				<td width="30%">内容</td>
				<td>
					${ order.content }
				</td>
			</tr>
			<tr>
				<td width="30%">状态（-2已消单、-1已退单、0已下单、1已出单、2已成单、3已评价）</td>
				<td>
					<c:if test="${order.status eq 3}">
					<p>已评价<p>
					</c:if>
					<c:if test="${order.status eq 2}">
					<p>已成单<p>
					</c:if>
					<c:if test="${order.status eq 1}">
					<p>已出单<p>
					</c:if>
					<c:if test="${order.status eq 0}">
					<p>已下单<p>
					</c:if>
					<c:if test="${order.status eq -1}">
					<p>已退单<p>
					</c:if>
					<c:if test="${order.status eq -2}">
					<p>已消单<p>
					</c:if>
				</td>
			</tr>
			<tr>
				<td>用餐地点(0堂食，1外卖，2快递)</td>
				<td>
					<c:if test="${order.diningPlaceType eq 2}">
					<p>快递<p>
					</c:if>
					<c:if test="${order.diningPlaceType eq 1}">
					<p>外卖<p>
					</c:if>
					<c:if test="${order.diningPlaceType eq 0}">
					<p>堂食<p>
					</c:if>
				</td>
			</tr>
			<tr>
				<td>收货地址</td>
				<td>
					${ order.receiverAddress }
				</td>
			</tr>
			<tr>
				<td>收货人姓名</td>
				<td>
					${ order.receiverName }
				</td>
			</tr>
			<tr>
				<td>收货手机</td>
				<td>
					${ order.receiverMobile }
				</td>
			</tr>
			<tr>
				<td>收货备注</td>
				<td>
					${ order.receiverRemark }
				</td>
			</tr>
			<tr>
				<td>配送员姓名</td>
				<td>
					${ order.deliverName }
				</td>
			</tr>
			<tr>
				<td>配送员电话</td>
				<td>
					${ order.deliverMobile }
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<c:if test="${order.status == 1}">
						<input type="submit" value="退 单" onclick="backOrder('${ order.id }')" />
					</c:if>
					<c:if test="${order.status == 1}">
						<input type="submit" value="确认收货" onclick="finishOrder('${ order.id }')" />
					</c:if>
					<c:if test="${order.status == 2}">
						<input type="submit" value="评  价" onclick="evaluateOrder('${ order.id }')" />
					</c:if>
				</td>
			</tr>
		</table>
	</form>
	<script type="text/javascript">

		function backOrder(orderId){
			var url = host + "/cl/update/backtime";
			var params = {"orderId": orderId};
			$.post(url, params, function (result) {
                window.location.href = host + "/clOrderList";
			});
		}

		function finishOrder(orderId){
			var url = host + "/cl/update/finishtime";
			var params = {"orderId": orderId};
			$.post(url, params, function (result) {
                window.location.href = host + "/clOrderList";
			});
		}

		function evaluateOrder(orderId){
			//页面层
			layer.open({
				type: 1,
				title: '评价这单',
				skin: 'layui-layer-rim', //加上边框
				area: ['420px', '240px'], //宽高
				content: 'html内容'
			});
		}

	</script>
</body>
</html>



